import 'package:bruno/bruno.dart';
import 'package:flutter/material.dart';
import 'package:getwidget/getwidget.dart';
import 'package:meal/constant/sizes.dart';
import 'package:meal/utils/colors.dart';
import 'package:meal/utils/styles.dart';
import 'package:meal/utils/tools.dart';

///
/// 团购使用规则
///
class GroupUseRule extends StatefulWidget {
  const GroupUseRule({Key? key}) : super(key: key);

  @override
  State<GroupUseRule> createState() => _GroupUseRuleState();
}

class _GroupUseRuleState extends State<GroupUseRule> {
  String hint = '''
    例子：
    该商品不可与商家其他优惠同享。
    酒水饮料等问题，请致电商家咨询，以商家反馈为准。
    如部分菜品因时令或其他不可抗因素导致无法提供，商家会用等价菜品替换，具体事宜请与商家协商。
    仅限到店堂食，不提供自提外带，不提供送餐。
  ''';

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: ToolsUtils.getDefaultBackgroundColor(),
      appBar: ToolsUtils.getDefaultBrnAppBar('使用规则'),
      body: SingleChildScrollView(
        child: Column(
          children: [
            Container(
              margin: const EdgeInsets.only(top: Sizes.default20),
              padding: const EdgeInsets.only(
                  top: Sizes.default20,
                  left: Sizes.default15,
                  right: Sizes.default15,
                  bottom: Sizes.default10),
              decoration: const BoxDecoration(
                color: Colors.white
              ),
              child: ListBody(
                children: [
                  Container(
                    alignment: Alignment.centerLeft,
                    padding: const EdgeInsets.symmetric(horizontal: Sizes.default10),
                    child: Text(
                      '请输入团购使用中文规则',
                      style: StylesUtils.customTextStyle(
                          color: ColorsUtils.colorCcc, fontSize: Sizes.default15),
                    ),
                  ),
                  Container(
                    alignment: Alignment.centerLeft,
                    padding: const EdgeInsets.all(Sizes.default10),
                    child: BrnInputText(
                      hint: hint,
                      minHeight: 250,
                      maxHeight: 400,
                      minLines: 5,
                      maxHintLines: 10,
                      maxLength: 500,
                      padding: EdgeInsets.zero,
                    ),
                  )
                ],
              ),
            )
          ],
        ),
      ),
      bottomNavigationBar: SafeArea(
        top: false,
        child: Container(
          height: Sizes.default60,
          alignment: Alignment.center,
          child: FractionallySizedBox(
            widthFactor: 0.8,
            heightFactor: 0.75,
            child: GFButton(
                onPressed: () {},
                text: '确定',
                textStyle: StylesUtils.customTextStyle(fontSize: Sizes.default16),
                shape: GFButtonShape.pills,
                type: GFButtonType.solid,
                size: GFSize.LARGE,
                color: ColorsUtils.parseColorFromHexString(ColorsUtils.colorFf6)),
          ),
        ),
      )
    );
  }
}
